<template>
  <div>
    <h1>这里面用来去测试一些功能</h1>

    <!-- <h1>显示总store当中e:{{ $store.state.e }}</h1>
    <h1>显示home模块当中name:{{ $store.state.home.name }}</h1>
    <h1>显示user模块当中name:{{ $store.state.user.name }}</h1> -->

    <h1>显示总store当中e:{{ e }}</h1>
    <h1>显示home模块当中name:{{ name }}</h1>
    <h1>显示user模块当中name:{{ name1 }}</h1>
    <button @click="test">触发home当中fn1这个actions函数</button>
    <button @click="test2">触发user当中FN2这个mutations函数</button>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: "Test",
  computed: {
    /*  e() {
      return this.$store.stae.e;
    }, */

    ...mapState(["e"]),
    ...mapState({
      name: (state) => state.home.name,
      name1: (state) => state.user.name,
    }),
  },
  methods: {
    test() {
      this.$store.dispatch("fn1");
    },
    test2() {
      this.$store.commit("FN2");
    },
  },
};
</script>

<style lang="less" scoped>
</style>
